﻿using System;
using System.Linq;
using System.Text;
using DevExpress.Xpo;
using DevExpress.ExpressApp;
using System.ComponentModel;
using DevExpress.ExpressApp.DC;
using DevExpress.Data.Filtering;
using DevExpress.Persistent.Base;
using System.Collections.Generic;
using DevExpress.ExpressApp.Model;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Persistent.Validation;

namespace aztall.Module.BusinessObjects
{
	[DefaultClassOptions, XafDefaultProperty("DisplayText"), NavigationItem("Administration")]
	[ImageName("BO_StateMachine")]
	public class Status : RootObject
	{
		public const string Sku = "SKU";
		public const string Promo = "PROMO";
		public const string ActiveInactive = "ActiveInactive";
		protected string _Category;
		protected string _StatusCode;
		protected string _StatusName;

		public Status(Session session)
				: base(session)
		{
		}
		public override void AfterConstruction()
		{
			base.AfterConstruction();
		}
		public string Category
		{
			get { return _Category; }
			set { SetPropertyValue(nameof(Category), ref _Category, value); }
		}
		public string StatusCode
		{
			get { return _StatusCode; }
			set { SetPropertyValue(nameof(StatusCode), ref _StatusCode, value); }
		}
		public string StatusDesc
		{
			get { return _StatusName; }
			set { SetPropertyValue(nameof(StatusDesc), ref _StatusName, value); }
		}
		[VisibleInListView(false), VisibleInDetailView(false), XafDisplayName("Status List")]
		public string DisplayText
		{
			get { return string.Format("{0}: {1}", StatusCode, StatusDesc); }
		}
		public static Status Get(Session session, string category, string statusCode)
		{
			Status result = session.GetObjectByKey<Status>(StatusHelper.GetOid(category, statusCode));
			return result;

		}
	}
}
